#pragma once

#include <QThread>
#include <QSize>
#include <QImageReader>
#include <QMutex>
#include <QWaitCondition>
#include "mediaitem.h"

class ImageLoader
{
public:
    ImageLoader();
    QImage load(const QString & filename, const QSize & size);
    QImage loadRaw(const QString & filename, const QSize & size);
    QImage loadNative(const QString & filename, const QSize & size);

    void cancel();

    bool supports(const QString & suffix);

private:
    void scale(QImage &image, const QSize & size, int orientation);
    int orientation(const QString & filename);

    bool m_cancel;

    QSet<QString> m_supportedFormats;
};
